﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
using System.Data;
using Model;
namespace DAL
{
  public     class LoginsDAL
    {
        /// <summary>
        /// 链接字符串
        /// </summary>
        SqlConnection con = new SqlConnection(" Data Source=PC201609040948;Initial Catalog=TianTianDai_Db;Persist Security Info=True;User ID=sa;Pwd=123456");

        /// <summary>
        /// 用户登陆操作的功能
        /// </summary>
        /// <returns></returns>
        public int login(string Name,string pwd)
        {
            con.Open();
            string str = "LoginsDL";
            SqlCommand com = new SqlCommand(str,con);
            com.CommandType = CommandType.StoredProcedure;
            SqlParameter p1 = new SqlParameter("UserName",Name);
            SqlParameter p2 = new SqlParameter("UserPwd", pwd);
            SqlParameter p3= new SqlParameter("ids",SqlDbType.Int);
            p3.Direction = System.Data.ParameterDirection.Output;
            com.Parameters.Add(p1);
            com.Parameters.Add(p2);
            com.Parameters.Add(p3);
            com.ExecuteNonQuery();
            var d1 = (int)com.Parameters["ids"].Value;
            return d1;
        }
    }
}
